<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="../jquery-1.12.4.js"></script>
    <input type="text" name="number-text">
    <select name="yunsuan">
        <option value="0">+</option>
        <option value="1">-</option>
        <option value="2">*</option>
        <option value="3">/</option>
    </select>
    <input type="text" name="number-text">
    <button>计算</button>
    <input type="text" name="number-text">
    <script>
        let $text = $("input[name = 'number-text']");
        let $ys = $("select[name='yunsuan']");
        let $btn = $("button");
        let all = 0;
        $btn.click(function () {
            console.log($ys.val());
            switch ($ys.val()) {
                case "0":
                    all = parseInt($($text[0]).val()) + parseInt($($text[1]).val());
                    $($text[2]).val(all);
                    break;
                case "1":
                    all = parseInt($($text[0]).val()) - parseInt($($text[1]).val());
                    $($text[2]).val(all);
                    break;
                case "2":
                    all = parseInt($($text[0]).val()) * parseInt($($text[1]).val());
                    $($text[2]).val(all);
                    break;
                case "3":
                    all = parseInt($($text[0]).val()) / parseInt($($text[1]).val());
                    $($text[2]).val(all.toString()); //整数无法直接作为函数的值，tostring
                    break;
            }
        });
    </script>
</body>

</html>